﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IHISCETeim.DAL;
using IHISCETeim.Model;
using IHISCETeim.Library;
using System.Data;

namespace IHISCETeim.BLL
{
    public  class ODailyController
    {
        /// <summary>
        /// 添新日报表
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public static int Add(ODailyInfo obj)
        {
            return ODailyDAL.Add(obj);
        }
        /// <summary>
        /// 删除日报表
        /// </summary>
        /// <param name="DailyId"></param>
        /// <returns></returns>
        public static bool Delete(int DailyId)
        {
            return ODailyDAL.Delete(DailyId);
        }
        /// <summary>
        /// 日报表分页
        /// </summary>
        /// <param name="UserName"></param>
        /// <param name="PageIndex"></param>
        /// <param name="PageSize"></param>
        /// <param name="Sort"></param>
        /// <param name="TotalCount"></param>
        /// <returns></returns>
        public static DataTable GetPagination(string UserName,string SerialNumber,string GongWei, int PageIndex, int PageSize, string Sort, ref int TotalCount)
        {
            return ODailyDAL.GetPagination(UserName,SerialNumber,GongWei, PageIndex, PageSize, Sort, ref  TotalCount);
        }
        /// <summary>
        /// 修改日报表记录
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public static bool Update(ODailyInfo obj)
        {
            return ODailyDAL.Update(obj);
        }

        public static ODailyInfo GetById(int DailyId)
        {
            return CBO.FillObject<ODailyInfo>(ODailyDAL.GetById(DailyId));
        }

        #region 报表相关
        /// <summary>
        /// 根据机号获取其所有的作业日报表记录
        /// </summary>
        /// <param name="SerialNumber"></param>
        /// <returns></returns>
        public static IDataReader GetListBySerialNumber(string SerialNumber)
        {
            return ODailyDAL.GetListBySerialNumber(SerialNumber);
        }

        /// <summary>
        /// 报表:
        /// 每台机器的直接工时统计
        /// </summary>
        /// <param name="WorkDateForm"></param>
        /// <param name="WorkDateTo"></param>
        /// <returns></returns>
        public static DataTableCollection GetMachineTaskTimeChart(string WorkDateForm, string WorkDateTo)
        {
            return ODailyDAL.GetMachineTaskTimeChart(WorkDateForm, WorkDateTo);
        }
        /// <summary>
        /// 获取直接间接工时
        /// </summary>
        /// <param name="WorkDateForm"></param>
        /// <param name="WorkDateTo"></param>
        /// <param name="jobtype">直接,间接</param>
        /// <returns></returns>
        public static double GetZJJJTaskTime(string WorkDateForm, string WorkDateTo, string jobtype)
        {
            return ODailyDAL.GetZJJJTaskTime(WorkDateForm, WorkDateTo, jobtype);
        }

        public static DataTableCollection GetMachineTaskTime2(string WorkDateForm, string WorkDateTo)
        {
            return ODailyDAL.GetMachineTaskTime2(WorkDateForm, WorkDateTo);
        }
        /// <summary>
        /// 获取当月每台机器负担工时
        /// </summary>
        /// <param name="WorkDateForm"></param>
        /// <param name="WorkDateTo"></param>
        /// <returns></returns>
        public static DataTable GetMachineTaskTime3(string WorkDateForm, string WorkDateTo)
        {
            return ODailyDAL.GetMachineTaskTime3(WorkDateForm, WorkDateTo);
        }
        /// <summary>
        /// 按工位统计工时
        /// </summary>
        /// <param name="WorkDateForm"></param>
        /// <param name="WorkDateTo"></param>
        /// <returns></returns>
        public static DataTable GetMachineTaskTime4(string WorkDateForm, string WorkDateTo)
        {
            return ODailyDAL.GetMachineTaskTime4(WorkDateForm, WorkDateTo);
        }

        /// <summary>
        /// 按项目统计工位工时
        /// </summary>
        /// <param name="WorkDateForm"></param>
        /// <param name="WorkDateTo"></param>
        /// <returns></returns>
        public static DataTable GetMachineTaskTime4_GroupBySerialNumber(string SerialNumber)
        {
            return ODailyDAL.GetMachineTaskTime4_GroupBySerialNumber(SerialNumber);
        }
        /// <summary>
        /// 按项目获取各工位所耗工时
        /// </summary>
        /// <param name="SerialNumber"></param>
        /// <returns></returns>
        public static DataTable GetMachineTaskTime4_GroupByGongWei(string SerialNumber)
        {
            return ODailyDAL.GetMachineTaskTime4_GroupByGongWei( SerialNumber);
        }
        /// <summary>
        /// 按项目统计直接工时对比
        /// </summary>
        /// <param name="WorkDateForm"></param>
        /// <param name="WorkDateTo"></param>
        /// <returns></returns>
        public static DataTable GetMachineTaskTime5(string WorkDateForm, string WorkDateTo)
        {
            return ODailyDAL.GetMachineTaskTime5(WorkDateForm, WorkDateTo);
        }

        /// <summary>
        /// 按月统计工作内容对比表
        /// </summary>
        /// <param name="WorkDateForm"></param>
        /// <param name="WorkDateTo"></param>
        /// <returns></returns>
        public static DataTable GetMachineTaskTime6(string WorkDateForm, string WorkDateTo)
        {
            return ODailyDAL.GetMachineTaskTime6(WorkDateForm, WorkDateTo);
        }
        #endregion

        #region 质量管理部 工时统计报表
        /// <summary>
        /// 各机型直接检验工时平均值
        /// </summary>
        /// <param name="WorkDateForm"></param>
        /// <param name="WorkDateTo"></param>
        /// <returns></returns>
        public static DataTableCollection ZGGetReport1(string WorkDateForm, string WorkDateTo)
        {
            return ODailyDAL.ZGGetReport1(WorkDateForm, WorkDateTo);
        }
        /// <summary>
        /// 每月直接间接工时对比
        /// </summary>
        /// <param name="WorkDateForm"></param>
        /// <param name="WorkDateTo"></param>
        /// <returns></returns>
        public static DataTableCollection ZGGetReport2(string WorkDateForm, string WorkDateTo)
        {
            return ODailyDAL.ZGGetReport2(WorkDateForm, WorkDateTo);
        }

        /// <summary>
        /// 按人员统计工时比
        /// </summary>
        /// <param name="WorkDateForm"></param>
        /// <param name="WorkDateTo"></param>
        /// <returns></returns>
        public static DataTable ZGGetReport4(string WorkDateForm, string WorkDateTo)
        {
            return ODailyDAL.ZGGetReport4(WorkDateForm, WorkDateTo);
        }

        /// <summary>
        /// 按人员统计工时比_每个人员的工作内容时间
        /// </summary>
        /// <param name="WorkDateForm"></param>
        /// <param name="WorkDateTo"></param>
        /// <returns></returns>
        public static DataTable ZGGetReport4_GroupByRealName(string WorkDateForm, string WorkDateTo, string RealName)
        {
            return ODailyDAL.ZGGetReport4_GroupByRealName(WorkDateForm, WorkDateTo, RealName);
        }

        /// <summary>
        /// 各机型统计直接工时对比
        /// </summary>
        /// <param name="WorkDateForm"></param>
        /// <param name="WorkDateTo"></param>
        /// <returns></returns>
        public static DataTable ZGReport5(string WorkDateForm, string WorkDateTo)
        {
            return ODailyDAL.ZGReport5(WorkDateForm, WorkDateTo);
        }

        /// <summary>
        /// 按月统计工作内容对比表
        /// </summary>
        /// <param name="WorkDateForm"></param>
        /// <param name="WorkDateTo"></param>
        /// <returns></returns>
        public static DataTable ZGReport6(string WorkDateForm, string WorkDateTo)
        {
            return ODailyDAL.ZGReport6(WorkDateForm, WorkDateTo);
        }
        #endregion
    }
}
